/**
 * 
 */
package com.ruyipu.forum.base;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.Application;
import android.app.ProgressDialog;
import android.os.Handler;

/**
 * @author donald
 *
 */
public class RFApplication extends Application {

	private static List<Activity> activityList = new ArrayList<Activity>();
	
	private static int userId = 0;
	
	public static ProgressDialog myDialog;

	protected static Handler myHandler;
	
	public static void addActivity(Activity activity) {
		activityList.add(activity);
	}
	
	public static void exitRF() {
		for(Activity activity : activityList) {
			activity.finish();
		}
		android.os.Process.killProcess(android.os.Process.myPid());
	}
	
	public static void finish(Activity _activity) {
		for(Activity activity : activityList) {
			if(activity.equals(_activity)) {
				activity.finish();
				return;
			}
		}
	}
	
	public static void logined(int _userId) {
		userId = _userId;
	}
	
	public static int getUserId() {
		return userId;
	}

}
